package reflectiondemo;

public class Student implements Comparable<Student> {

    //属性
    private String stuName;
    private String stuNum;
    private  double stuScore;

    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public String getStuNum() {
        return stuNum;
    }

    public void setStuNum(String stuNum) {
        this.stuNum = stuNum;
    }

    public double getStuScore() {
        return stuScore;
    }

    public void setStuScore(double stuScore) {
        this.stuScore = stuScore;
    }

    //行为
    public Student(){}

    public  Student(String stuName,String stuNum,double stuScore){
        this.stuName = stuName;
        this.stuNum = stuNum;
        this.stuScore  = stuScore;

    }

    //学习的行为
    public void doStuding(){
        System.out.println("I am studing.............");
    }

    /**
     * 学习的行为
     */
    public  void doStuding(String strAddress){

        System.out.println("I am studing at "+strAddress);
    }

    @Override
    public String toString() {
        return "Student{" +
                "stuName='" + stuName + '\'' +
                ", stuNum='" + stuNum + '\'' +
                ", stuScore=" + stuScore +
                '}';
    }

    public  int compareTo(Student student){
        //比较业务逻辑的实现
        //默认值，默认等于
        int i = 0;
        if (student  != null){
            if (this.getStuScore()>student.getStuScore()){
                //大于
                i = 1;

            }
            if (this.getStuScore()<student.getStuScore()){
                i = -1;

            }
        }
        return  i *-1;

    }


}
